package com.qy137.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result implements Serializable {
    private Integer code;
    private String msg;
    private Object data;



    public static Result success(){
        return new Result(1,"操作成功",null);
    }

    public static Result success(String msg){
        return new Result(1,msg,null);
    }

    public static Result success(Object data , String msg){
        return new Result(1,msg,data);
    }

    public static Result fail(){
        return new Result(2,"操作失败",null);
    }

    public static Result fail(String msg){
        return new Result(2,msg,null);
    }

}
